package com.vict.bean.app.appbase.vo;

import com.alibaba.fastjson.annotation.JSONField;
import com.vict.entity.AppVersion;
import com.vict.framework.fastjsonserializer.EnumDeserializer;
import com.vict.framework.fastjsonserializer.EnumSerializer;
import lombok.Data;

@Data
public class CheckUpdateVO {

    @JSONField(serialize = false, deserialize = false)
    private AppVersion oneMethodApk;

    @JSONField(serialize = false, deserialize = false)
    private AppVersion oneForce;

    @JSONField(serializeUsing = EnumSerializer.class, deserializeUsing = EnumDeserializer.class)
    public AppVersion.UpdateMethod getUpdateMethod(){
        if(oneMethodApk != null){
            return AppVersion.UpdateMethod.APK;
        }else{
            return AppVersion.UpdateMethod.WGT;
        }
    }

    @JSONField(serializeUsing = EnumSerializer.class, deserializeUsing = EnumDeserializer.class)
    public AppVersion.IsForce getIsForce(){
        if(oneForce != null){
            return AppVersion.IsForce.yes;
        }else{
            return AppVersion.IsForce.no;
        }
    }
}
